package ink.lovejinhu.swardToOffer;

import ink.lovejinhu.common.TreeNode;

/**
 * @Author: jin
 * @Date: 2021/8/25 20:52
 * @Version: V1.0
 * @Slogan: Great people are not born great, but show their greatness in the process of growing up
 **/
public class Offer_055 {
    /**
     * 树的深度
     *
     * @param root
     * @return
     */
    public int maxDepth(TreeNode root) {
        if (root == null) return 0;
        return Math.max(maxDepth(root.left), maxDepth(root.right)) + 1;
    }
}
